/**
 * 
 */
package org.statewalker.core;


/**
 * @author kotelnikov
 */
public abstract class ProcessState extends AsyncState {

    @Override
    protected final void doActivate(IEvent event, ICallback callback)
        throws Exception {
        IProcessContext context = prepareContext(event);
        String processName = getProcessName(event);
        Core core = fProcessContext.getCore();
        core.startProcess(processName, context, callback);
    }

    protected abstract String getProcessName(IEvent event);

    protected IProcessContext prepareContext(IEvent event) {
        return getContext();
    }
}
